package com.homegoods.orderinfodetail.ui.activity;

import android.annotation.SuppressLint;
import android.os.Bundle;
import android.view.View;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.homegoods.orderinfodetail.R;
import com.homegoods.orderinfodetail.databinding.InfoActivityInvoiceBindingImpl;
import com.homegoods.orderinfodetail.presenter.InvoicePresenter;
import com.homegoods.orderinfodetail.ui.fragment.TipDialog;
import com.homegoods.aroutercomment.ARouterPath;
import com.jakewharton.rxbinding2.widget.RxCompoundButton;
import com.kedll.library.base.MyBaseFragmentActivity;
import com.kedll.library.mvp.BaseView;

/**
 * 发票
 * @author QiQi
 */
@Route(path = ARouterPath.PATH_INVOICE)
public class InvoiceActivity extends MyBaseFragmentActivity<InfoActivityInvoiceBindingImpl, InvoicePresenter> implements BaseView {

    @Override
    public int getLayout() {
        return R.layout.info_activity_invoice;
    }

    @SuppressLint("CheckResult")
    @Override
    protected void initEvent() {

        mBinding.setItem(mPresenter);

        RxCompoundButton.checkedChanges(mBinding.rbPerson)
                .subscribe(aBoolean -> mPresenter.invoiceType.set(aBoolean));



    }

    @Override
    protected void initToolBar(Bundle savedInstanceState) {
        super.initToolBar(savedInstanceState);
        setTitle("发票");
        setTopRightButton("发票须知", v -> new TipDialog()
                .setTitle("发票须知")
                .setMsg("1、第三方卖家销售的商品/服务的发票由" +
                        "卖家自行出具、提供，发票类型和内容由" +
                        "卖家提供实际商品、服务情况而定。\n" +
                        "2、发票金额不包括金币、抵用券、服务" +
                        "费、促销返利的部分。")
                .showDialog(getSupportFragmentManager(), "tipDialog"));
    }

    @Override
    protected InvoicePresenter getPresenter() {
        return new InvoicePresenter(this);
    }


    /**
     * 保存发票信息
     *
     * @param view
     */
    public void onClick(View view) {

    }

    /**
     * 纳税人识别说明
     *
     * @param view
     */
    public void onInfoClick(View view) {
        new TipDialog()
                .setTitle("纳税人识别号说明")
                .setMsg("从7月1日起企业索取发票时，应向销售方" +
                        "提供纳税人识别号，请根据提示标准填写" +
                        "贵单位号码，以免影响您的发票报销。")
                .showDialog(getSupportFragmentManager(), "tipDialog");
    }

}
